package com.xinhe.web.controller;

import com.querydsl.core.QueryResults;
import com.xinhe.web.common.Result;
import com.xinhe.web.entity.ValueConfig;
import com.xinhe.web.service.ValueConfigService;
import com.xinhe.web.vo.ValueConfigModel;
import com.xinhe.web.vo.ValueConfigView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "系统控制值配置", tags = {"系统控制值配置"})
@RestController
@RequestMapping(value = {"/valueConfig"}, produces = {"application/json;charset=UTF-8"})
public class ValueConfigController
{
    @Autowired
    private ValueConfigService valueConfigService;

    @ApiOperation(httpMethod = "GET", value = "分页查询")
    @RequestMapping({"/pageValueConfig"})
    QueryResults<ValueConfigView> pageValueConfig(String type, int pageNum, int pageSize) {
        return this.valueConfigService.pageValueConfig(type,pageNum,pageSize);
    }

    @ApiOperation(httpMethod = "POST", value = "保存")
    @RequestMapping({"/saveValueConfig"})
    public Result saveValueConfig(ValueConfigModel model) {
        return this.valueConfigService.saveValueConfig(model);
    }

    @ApiOperation(httpMethod = "GET", value = "删除")
    @ApiImplicitParam(name = "valueConfigId", value = "标识", dataTypeClass = Long.class, required = true)
    @RequestMapping({"/deleteValueConfig"})
    public Result deleteValueConfig(String valueConfigId) {
        return this.valueConfigService.deleteValueConfig(valueConfigId);
    }

    @ApiOperation(httpMethod = "GET", value = "查询详情")
    @ApiImplicitParam(name = "valueConfigId", value = "标识", dataTypeClass = Long.class, required = true)
    @RequestMapping({"/detailValueConfig"})
    public Result<ValueConfig> detailValueConfig(String valueConfigId) {
        return this.valueConfigService.detailValueConfig(valueConfigId);
    }
}